"""
搜索页面
"""
import pages.webpage


class SearchPage(pages.webpage.WebPage):
    # 百度搜索页面
    url = "https://baidu.com"

    # 页面核心元素 定位器
    search_locator = ('id',  "kw")
    search_btn_locator = ("id", "su")

    # 页面核心元素 方法
    def search(self,  txt):
        self.input_text(self.search_locator,  txt)
        self.is_click(self.search_btn_locator)


if __name__ == '__main__':
    from utils.browser_utils import init_chrome_browser
    from config.constants import chrome_path, driver_path

    driver = init_chrome_browser(chrome_path,driver_path)
    search_page = SearchPage(driver)
    search_page.get_url(search_page.url)
    search_page.search("selenium")

